Derivative
Check options and parameters of derivative method
Derivative filter is a special case of a gradient filter, therefore it uses gradient algorithm. However, the key difference are the kernels used in this very algorithm. In ImageJS there are three distinguished kernels: Sobel, Scharr and Prewitt.


Parameters and default values
options
Options
Option | Default value |
---|---|
bitDepth | image.bitDepth |
borderType | replicate |
borderValue | 0 |
filter | sobel |
Sobel kernel
Scharr kernel
Prewitt kernel
info
As was mentioned, derivative filter is a type of gradient filter. Therefore using the same kernels with gradient filter will provide the same image output.Derivative filter simplifies some kernel's application.
Applying Sobel kernel using gradient filter
return image.gradientFilter({
kernelX: [
[-1, 0, 1],
[-2, 0, 2],
[-1, 0, 1],
],
kernelY: [
[-1, -2, -1],
[0, 0, 0],
[1, 2, 1],
],
});
Applying Sobel kernel using derivative filter
return image.derivativeFilter({ filter: 'sobel' });